﻿@{
    ViewBag.Title = "Tablet";
    ViewBag.BackUrl = Url.Action("Tablets", "Product");
    LineFocus.Nikcron.Models.Lookup Manufactures = ViewBag.Manufactures;
}
@model Nickron.Database.Tablet

@using (Html.BeginForm("TabletMaintenance", "Product", FormMethod.Post, new { onsubmit = "return ValidateForm();" }))
{

    <div class="col-md-6">
        <div class="box box-danger">
            <div class="box-body">

                <div class="box-header">
                    <h3 class="box-title"> General Feature</h3>
                </div>

                <div class="form-group">
                    <label>Product Date:</label>
                    <div class="input-group">
                        <div class="input-group-addon">
                            <i class="fa fa-calendar"></i>
                        </div>
                        <input name="ProductDate" id="ProductDate" type="text" data-mask="" data-inputmask="'alias': 'dd/mm/yyyy'" class="form-control">
                    </div><!-- /.input group -->
                </div><!-- /.form group -->

                <div class="form-group">
                    <label>In The Box:</label><span class="astrisk">*</span>
                    <div class="input-group">
                        <div class="input-group-addon">
                            <i class=""></i>
                        </div>
                        <input id="InBox" name="InBox" type="text" maxlength="1000" class="form-control" />
                    </div><!-- /.input group -->
                </div><!-- /.form group -->

                <div class="form-group">
                    <label>Model Number:</label><span class="astrisk">*</span>
                    <div class="input-group">
                        <div class="input-group-addon">
                            <i class=""></i>
                        </div>
                        <input id="ModelNumber" name="ModelNumber" maxlength="200" type="text" class="form-control" />
                    </div><!-- /.input group -->
                </div><!-- /.form group -->

                <div class="form-group">
                    <label>Model Name:</label><span class="astrisk">*</span>
                    <div class="input-group">
                        <div class="input-group-addon">
                            <i class=""></i>
                        </div>
                        <input id="ModelName" name="ModelName" type="text" maxlength="500" class="form-control" />
                    </div><!-- /.input group -->
                </div><!-- /.form group -->

                <div class="form-group">
                    <label>Manufacture:</label><span class="astrisk">*</span>
                    <div class="input-group">
                        <div class="input-group-addon">
                            <i class=""></i>
                        </div>
                        <select id="Manufacture" name="Manufacture" class="selectpicker" title="Select Manufacture">
                            @Html.Partial("Dropdown", Manufactures)
                        </select>
                    </div><!-- /.input group -->
                </div><!-- /.form group -->

                <div class="form-group">
                    <label>Voice Call:</label>
                    <div class="input-group">
                        <div class="input-group-addon">
                            <i class=""></i>
                        </div>
                        <input id="CallFeatures" name="CallFeatures" type="text" maxlength="40" class="form-control" />
                    </div><!-- /.input group -->
                </div><!-- /.form group -->

                <div class="form-group">
                    <label>Processor:</label><span class="astrisk">*</span>
                    <div class="input-group">
                        <div class="input-group-addon">
                            <i class=""></i>
                        </div>
                        <input id="Processor" name="Processor" type="text" maxlength="100" class="form-control" />
                    </div><!-- /.input group -->
                </div><!-- /.form group -->

                <div class="box-header">
                    <h3 class="box-title">Memory</h3>
                </div>

                <div class="form-group">
                    <label>Internal Storage:</label><span class="astrisk">*</span>
                    <div class="input-group">
                        <div class="input-group-addon">
                            <i></i>
                        </div>
                        <input id="InternalStorage" name="InternalStorage" type="text" maxlength="100" class="form-control pull-right" />
                    </div><!-- /.input group -->
                </div><!-- /.form group -->

                <div class="form-group">
                    <label>Expandable Memory:</label>
                    <div class="input-group">
                        <div class="input-group-addon">
                            <i></i>
                        </div>
                        <input id="ExternalStorage" name="ExternalStorage" type="text" maxlength="100" class="form-control pull-right" />
                    </div><!-- /.input group -->
                </div><!-- /.form group -->

                <div class="box-header">
                    <h3 class="box-title">Dimensions</h3>
                </div>

                <div class="form-group">
                    <label>Size:</label><span class="astrisk">*</span>
                    <div class="input-group">
                        <div class="input-group-addon">
                            <i></i>
                        </div>
                        <input id="Dimension" name="Dimension" type="text" maxlength="100" class="form-control pull-right" />
                    </div><!-- /.input group -->
                </div><!-- /.form group -->

                <div class="form-group">
                    <label>Weight:</label><span class="astrisk">*</span>
                    <div class="input-group">
                        <div class="input-group-addon">
                            <i></i>
                        </div>
                        <input id="Weight" name="Weight" type="text" maxlength="100" class="form-control pull-right" />
                    </div><!-- /.input group -->
                </div><!-- /.form group -->

                <div class="box-header">
                    <h3 class="box-title">OTHER FEATURES</h3>
                </div>

                <div class="form-group">
                    <label>Additional Features:</label>
                    <div class="input-group">
                        <div class="input-group-addon">
                            <i></i>
                        </div>
                        <textarea id="NoteSummary" name="NoteSummary" maxlength="1000" class="form-control pull-right"></textarea>
                    </div><!-- /.input group -->
                </div><!-- /.form group -->

                <div class="box-header">
                    <h3 class="box-title">WARRANTY</h3>
                </div>

                <div class="form-group">
                    <label>WarrantySummary:</label><span class="astrisk">*</span>
                    <div class="input-group">
                        <div class="input-group-addon">
                            <i></i>
                        </div>
                        <textarea id="WarrantySummary" name="WarrantySummary" maxlength="1000" class="form-control pull-right"></textarea>
                    </div><!-- /.input group -->
                </div><!-- /.form group -->

            </div><!-- /.box-body -->
        </div><!-- /.box -->
    </div><!-- /.col (left) -->

    <div class="col-md-6">
        <div class="box box-primary">
            <div class="box-body">

                <div class="box-header">
                    <h3 class="box-title">Platform</h3>
                </div>

                <div class="form-group">
                    <label>Operating System:</label><span class="astrisk">*</span>
                    <div class="input-group">
                        <div class="input-group-addon">
                            <i class=""></i>
                        </div>
                        <input id="OperatingSystem" name="OperatingSystem" maxlength="100" type="text" class="form-control pull-right" />
                    </div><!-- /.input group -->
                </div><!-- /.form group -->

                <div class="box-header">
                    <h3 class="box-title">Display</h3>
                </div>

                <div class="form-group">
                    <label>Display Size:</label><span class="astrisk">*</span>
                    <div class="input-group">
                        <div class="input-group-addon">
                            <i class=""></i>
                        </div>
                        <input id="DisplaySize" name="DisplaySize" type="text" maxlength="100" class="form-control pull-right" />
                    </div><!-- /.input group -->
                </div><!-- /.form group -->

                <div class="form-group">
                    <label>Display Type:</label><span class="astrisk">*</span>
                    <div class="input-group">
                        <div class="input-group-addon">
                            <i class=""></i>
                        </div>
                        <input id="DisplayType" name="DisplayType" type="text" maxlength="100" class="form-control pull-right" />
                    </div><!-- /.input group -->
                </div><!-- /.form group -->

                <div class="box-header">
                    <h3 class="box-title">Camera</h3>
                </div>

                <div class="form-group">
                    <label>Primary Camera:</label><span class="astrisk">*</span>
                    <div class="input-group">
                        <div class="input-group-addon">
                            <i></i>
                        </div>
                        <input id="PrimaryCamera" name="PrimaryCamera" type="text" maxlength="40" class="form-control pull-right" />
                    </div><!-- /.input group -->
                </div><!-- /.form group -->

                <div class="form-group">
                    <label>Secondry Camera:</label>
                    <div class="input-group">
                        <div class="input-group-addon">
                            <i></i>
                        </div>
                        <input id="SecondryCamera" name="SecondryCamera" type="text" maxlength="40" class="form-control pull-right" />
                    </div><!-- /.input group -->
                </div><!-- /.form group -->

                <div class="box-header">
                    <h3 class="box-title"> Internet Connectivity</h3>
                </div>

                <div class="form-group">
                    <label>Pre-Installed Browser:</label><span class="astrisk">*</span>
                    <div class="input-group">
                        <div class="input-group-addon">
                            <i></i>
                        </div>
                        <input id="PreinstalledBrowser" name="PreinstalledBrowser" type="text" maxlength="100" class="form-control pull-right" />
                    </div><!-- /.input group -->
                </div><!-- /.form group -->

                <div class="form-group">
                    <label>Wifi:</label>
                    <div class="input-group">
                        <div class="input-group-addon">
                            <i></i>
                        </div>
                        <input id="WiFi" name="WiFi" type="text" maxlength="60" class="form-control pull-right" />
                    </div><!-- /.input group -->
                </div><!-- /.form group -->

                <div class="form-group">
                    <span class="astrisk">*</span>
                    <label>USB Port:</label>
                    <div class="input-group">
                        <div class="input-group-addon">
                            <i></i>
                        </div>
                        <input id="USBPort" name="USBPort" type="text" maxlength="60" class="form-control pull-right" />
                    </div><!-- /.input group -->
                </div><!-- /.form group -->

                <div class="form-group">
                    <label>3G:</label>
                    <div class="input-group">
                        <div class="input-group-addon">
                            <i></i>
                        </div>
                        <input id="HSPA_3G" name="HSPA_3G" type="text" maxlength="60" class="form-control pull-right" />
                    </div><!-- /.input group -->
                </div><!-- /.form group -->

                <div class="form-group">
                    <label>2G:</label>
                    <div class="input-group">
                        <div class="input-group-addon">
                            <i></i>
                        </div>
                        <input id="GPRS_2G" name="GPRS_2G" type="text" maxlength="60" class="form-control pull-right" />
                    </div><!-- /.input group -->
                </div><!-- /.form group -->

                <div class="box-header">
                    <h3 class="box-title"> Multimedia</h3>
                </div>

                <div class="form-group">
                    <label>Video Format:</label>
                    <div class="input-group">
                        <div class="input-group-addon">
                            <i></i>
                        </div>
                        <input id="VideoFormat" name="VideoFormat" type="text" maxlength="60" class="form-control pull-right" />
                    </div><!-- /.input group -->
                </div><!-- /.form group -->

                <div class="form-group">
                    <label>Video Recording:</label>
                    <div class="input-group">
                        <div class="input-group-addon">
                            <i></i>
                        </div>
                        <input id="VideoRecording" name="VideoRecording" type="text" maxlength="40" class="form-control pull-right" />
                    </div><!-- /.input group -->
                </div><!-- /.form group -->

                <div class="form-group">
                    <label>Audio Formats Supported:</label>
                    <div class="input-group">
                        <div class="input-group-addon">
                            <i></i>
                        </div>
                        <input id="AudioFormat" name="AudioFormat" type="text" maxlength="60" class="form-control pull-right" />
                    </div><!-- /.input group -->
                </div><!-- /.form group -->
                
                <div class="form-group">
                    <label>MRP:</label><span class="astrisk">*</span>
                    <div class="input-group">
                        <div class="input-group-addon">
                            <i></i>
                        </div>
                        <input id="MRP" name="MRP" type="number" maxlength="100" class="form-control pull-right" />
                    </div><!-- /.input group -->
                </div><!-- /.form group -->

                <div class="box box-success">
                    <div class="box-footer">
                        <input type="hidden" name="Id" id="Id" value="@ViewBag.Id" />
                        <button type="submit" class="btn btn-primary" style=" width:80px;">Save</button>
                        <button type="reset" class="btn btn-primary" onclick="GoBackListing()" style=" width:80px;">Cancel</button>
                    </div>
                </div><!-- /.box -->

            </div><!-- /.box-body -->
        </div><!-- /.box -->
    </div><!-- /.col (right) -->

    <script>
         function GoBackListing() {
             window.location.replace('@Url.Action("Tablets","Product",null)');
         }
    function ValidateForm() {

        RequiredTextbox("ModelNumber", "Enter the Model Number")
        RequiredTextbox("ModelName", "Enter the Model Name")
        RequiredDropdown("Manufacture", -1, "Select a Manufacture");
        RequiredTextbox("Processor", "Enter the Processor")
        RequiredTextbox("InternalStorage", "Enter the Internal Storage")
        RequiredTextbox("Dimension", "Enter the Dimention Size")
        RequiredTextbox("Weight", "Enter the Dimention Weight")
        RequiredTextbox("WarrantySummary", "Enter the Warranty Summary")
        RequiredTextbox("OperatingSystem", "Enter the Operating System")
        RequiredTextbox("DisplaySize", "Enter the Display Size")
        RequiredTextbox("DisplayType", "Enter the Display Type")
        RequiredTextbox("PrimaryCamera", "Enter the Primary Camera")
        RequiredTextbox("PreinstalledBrowser", "Enter the Pre-Installed Browser")
        RequiredTextbox("USBPort", "Enter the USB Port")
        RequiredTextbox("MRP", "Enter MRP");
        return AlertError();
    }
    @*function LoadManufactures() {
        $.getJSON("@Url.Action("GetLookups", "Master", new { LookupType = "Manufacture" })", function (result) {
            var options = '';
            $.each(result, function (item) {
                options += '<option value="' + result[item].Id + '">' + result[item].Name + '</option>';
            });
            $("select#Manufacture").html(options);
        });
    }*@

    $(document).ready(function () {
        //LoadManufactures();
        $('.selectpicker').selectpicker();
        $('#ProductDate').datepicker();
        if ("@ViewBag.Id" != "0") {
            $('#Id').val('@Model.Id');
            $('#ProductDate').val('@Model.ProductDate');
            $('#InBox').val('@Model.InBox');
            $('#ModelName').val('@Model.ModelName');
            $('#ModelNumber').val('@Model.ModelNumber');
            $('#Manufacture').selectpicker("val", "@Model.ManufactureId");
            $('#CallFeatures').val('@Model.CallFeatures');
            $('#Processor').val('@Model.Processor');
            //$('#ProductColors').val('@Model.ProductColors');
            $('#ExternalStorage').val('@Model.ExternalStorage');
            $('#InternalStorage').val('@Model.InternalStorage');
            $('#Dimension').val('@Model.Dimension');
            $('#Weight').val('@Model.Weight');
            $('#NoteSummary').val('@Model.NoteSummary');
            $('#WarrantySummary').val('@Model.WarrantySummary');
            $('#OperatingSystem').val('@Model.OperatingSystem');
            $('#DisplaySize').val('@Model.DisplaySize');
            $('#DisplayType').val('@Model.DisplayType');
            $('#PrimaryCamera').val('@Model.PrimaryCamera');
            $('#SecondryCamera').val('@Model.SecondryCamera');
            $('#PreinstalledBrowser').val('@Model.PreinstalledBrowser');
            $('#WiFi').val('@Model.WiFi');
            $('#USBPort').val('@Model.Connectivity.USB');
            $('#HSPA_3G').val('@Model.Connectivity.HSPA_3G');
            $('#GPRS_2G').val('@Model.Connectivity.GPRS_2G');
            $('#Weight').val('@Model.Weight');
            $('#VideoFormat').val('@Model.VideoFormat');
            $('#VideoRecording').val('@Model.VideoRecording');
            $('#AudioFormat').val('@Model.AudioFormat');
            $('#MRP').val('@Model.MRP.Amount.Value.ToString("f2")');
            }
        });
    </script>

}
